<?php
namespace app\services;
class TreeService
{
    /***
     * 子集递归
     */
    public static function getTreeChildren($array,$pid=0){
        $list = [];
        foreach ($array as $key => $value){
            if($value['pid']==$pid){
                $value['children'] = self::getTreeChildren($array,$value['id']);
                $list[]=$value;
            }
        }
        return $list;
    }
}
